package easycloud.ecs.provider.aliyun.model;

import java.util.ArrayList;
import java.util.List;

import com.aliyun.openservices.oss.model.OSSObjectSummary;
import com.aliyun.openservices.oss.model.ObjectListing;

import easycloud.ecs.api.model.IStorageObjectListing;
import easycloud.ecs.api.model.IStorageObjectSummary;

public class AliyunStorageObjectListing implements IStorageObjectListing {

	private ObjectListing objectList;

	public AliyunStorageObjectListing(ObjectListing objectList) {
		this.objectList = objectList;
	}

	@Override
	public List<IStorageObjectSummary> getObjectSummaries() {
		List<IStorageObjectSummary> result = new ArrayList<IStorageObjectSummary>();
		List<OSSObjectSummary> adapterResult = objectList.getObjectSummaries();
		for (OSSObjectSummary summary : adapterResult) {
			result.add(new AliyunStorageObjectSummary(summary));
		}
		return result;
	}

}
